using Mbs.ComponentModel.Container.Context;

namespace Mbs.ComponentModel.Container.Injection
{
   
    public class InjectStrategy<TInspect, TInject> : Mbs.Listner, IInjectStrategy<TInspect, TInject>
        where TInspect : IInspect, new()
        where TInject : IInject, new()
    {


        public IInspect Inspect { get; private set; }
        public IInject Inject { get; private set; }

        public void Execute(IInspectContext ctx)
        {
            if (Inject == null && Inspect == null)
            {
                Inject = new TInject();
                Inspect = new InspectCacheProxy( new  TInspect());
            }
            Inject.Execute(Inspect.Execute(ctx));
        }
    }
}
